import {
  Controller,
  Get,
  Post,
  Provide,
  Body,
  ALL,
  Inject,
} from '@midwayjs/decorator';
@Provide()
@Controller('/')
export class HomeController {
  @Inject()
  userService: any;
  @Get('/')
  async home() {
    const users = await this.userService.getUser();
    return {
      body: users,
      code: 200,
    };
  }
  @Post('/')
  async createUser(@Body(ALL) body: any) {
    const user = await this.userService.createUser(body);
    console.log(user);
    return user;
  }
}
